<template>
  <div class="list-table">
    <template>
      <el-table v-loading="loading" :data="tableList" border>
        <el-table-column :label="$t('项目名称')" show-overflow-tooltip align="center" prop="dealName">
          <template slot-scope="scope">
            <router-link
              target="_blank"
              :to="{path:'/deal/home/dealBaseHome',query:{id:scope.row.dealId,companyId:scope.row.companyId, gpId: scope.row.gpId}}"
              class="link_a"
            >{{ scope.row.dealName }}</router-link>
          </template>
        </el-table-column>
        <el-table-column :label="$t('公司名称')" show-overflow-tooltip align="center" prop="companyName">
          <template slot-scope="scope">
            <router-link
              target="_blank"
              :to="{path:'/company/base/companyBaseHome',query:{companyId:scope.row.companyId}}"
              class="link_a"
            >{{ scope.row.companyName }}</router-link>
          </template>
        </el-table-column>
        <el-table-column :label="$t('负责人')" align="center" prop="personCharge" show-overflow-tooltip min-width="130">
          <template slot-scope="scope">
            <span>{{ $t(scope.row.personCharge) }}</span>
          </template>
        </el-table-column>
        <el-table-column :label="$t('关注等级')" align="center" prop="levelConcern" show-overflow-tooltip :formatter="levelConcernFormat" />
        <el-table-column :label="$t('项目来源')" align="center" prop="dealSource" show-overflow-tooltip />
      </el-table>
      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList(param)"
      />
    </template>
  </div>
</template>

<script>
import {
  findByNodeId
} from '@/api/base/deal/dealBase'

export default {
 data() {
    return {
      total: 0,
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        nodeId: undefined,
        stageType: undefined
      },
      // 关注等级
      levelConcernOptions: [],
      tableList: [],
      param: {
        nodeId: undefined,
        stageType: undefined
      }
    }
  },
  created() {
    // 关注等级
    this.getDicts('level_concern').then(response => {
      this.levelConcernOptions = response.data
    })
  },
  mounted() {
  },
  methods: {
    getList(data) {
      this.loading = true
      this.queryParams.nodeId = data.nodeId
      this.param.nodeId = data.nodeId
      this.queryParams.stageType = data.stageType
      this.param.stageType = data.stageType
      findByNodeId(this.queryParams).then(response => {
        this.tableList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    // 关注等级字典翻译
    levelConcernFormat(row) {
      return this.selectDictLabel(this.levelConcernOptions, row.levelConcern)
    },
    /** 搜索按钮操作 */
    queryHandle() {
      this.queryParams.pageNum = 1
      this.getList(this.param)
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryHandle()
    }
  }
}

</script>

